package com.mmd.manage.web;

import com.mmd.bean.CODE;
import com.mmd.bean.WebJsonBean;
import com.mmd.manage.service.RoleService;
import com.mmd.manage.vo.RoleEo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 角色
 */
@RequestMapping(value = "/api/role")
@Controller
public class RoleController {

    @Autowired
    private RoleService roleService;


    /**
     * 添加角色
     *
     * @return
     */
    @RequestMapping(value = "/addRole")
    @ResponseBody
    public WebJsonBean addRole(RoleEo eo) {
        roleService.addRole(eo);
        return new WebJsonBean(CODE.SUCCESS);
    }

    /**
     * 获取角色列表
     *
     * @return
     */
    @RequestMapping(value = "/getRoleList")
    @ResponseBody
    public WebJsonBean getRoleList() {
        return new WebJsonBean(CODE.SUCCESS, roleService.getRoleList());
    }
}
